package Day04;

import java.util.Scanner;

/**
 * Creat with IntelliJ IDEA
 * Description
 * User: mamba24
 * Date: 2022-09-08
 * Time: 23:15
 * To BE A Better Person-2020-3-2
 */
public class TestDemo2 {
    public static void func(int num, int base) {
        if (num >= base) {
            func(num / base, base);

        }
            if (num < 10) {
                System.out.print(num);
            } else {
                switch (num) {
                    case 10:
                        System.out.print("A");
                        break;
                    case 11:
                        System.out.print("B");
                        break;
                    case 12:
                        System.out.print("C");
                        break;
                    case 13:
                        System.out.print("D");
                        break;
                    case 14:
                        System.out.print("E");
                        break;
                    case 15:
                        System.out.print("F");
                        break;
                }
            }

    }

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int num = 0;
        int base = 0;
        //while (sc.hasNext()) {
            num = sc.nextInt();
            base = sc.nextInt();
            func(num, base);
        //}
    }
}

